{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": " Identify_intent_in_general_text.ipynb",
      "provenance": [],
      "collapsed_sections": [],
      "toc_visible": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "tOHVDa9DQQR5"
      },
      "source": [
        "![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png)\n",
        "\n",
        "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/nlu/blob/master/examples/colab/component_examples/classifiers/Identify_intent_in_general_text.ipynb)\n",
        "\n",
        "\n",
        "#[Identify intent in general text - SNIPS dataset](https://nlp.johnsnowlabs.com/2021/02/15/classifierdl_use_snips_en.html)\n",
        "\n",
        "Understand general commands and recognise the intent.\n",
        "\n",
        "\n",
        "\n",
        "This model can be used by services such as Alexa and Google Nest to understand the intent after converting speech to text and can help improve the user experince greatly.\n",
        "\n",
        "\n",
        "\n",
        "<br>\n",
        "\n",
        "This model can be used to predict the following news categories \n",
        "`AddToPlaylist`, `BookRestaurant`, `GetWeather`, `PlayMusic`, `RateBook`, `SearchCreativeWork`, `SearchScreeningEvent`\n",
        "\n",
        "<br>\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "The data Source used to train this can be found [here](https://github.com/MiuLab/SlotGated-SLU)\n",
        "\n",
        "<br>\n",
        "\n",
        "##Benchmark on Dataset \n",
        "![image.png]()"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "##1.Setup Java 8 and NLU"
      ],
      "metadata": {
        "id": "HIxATMI7ixJx"
      }
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "SF5-Z-U4jukd",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "0adfff86-4de6-4d1f-8eee-434481cfd197"
      },
      "source": [
        "!wget https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/scripts/colab_setup.sh -O - | bash\n",
        "\n",
        "import nlu"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "--2022-05-19 22:10:57--  https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/scripts/colab_setup.sh\n",
            "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...\n",
            "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 1665 (1.6K) [text/plain]\n",
            "Saving to: ‘STDOUT’\n",
            "\n",
            "\r-                     0%[                    ]       0  --.-KB/s               \r-                   100%[===================>]   1.63K  --.-KB/s    in 0s      \n",
            "\n",
            "2022-05-19 22:10:57 (33.5 MB/s) - written to stdout [1665/1665]\n",
            "\n",
            "Installing  NLU 3.4.4rc1 with  PySpark 3.0.3 and Spark NLP 3.4.3 for Google Colab ...\n",
            "Hit:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease\n",
            "Get:2 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ InRelease [3,626 B]\n",
            "Ign:3 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  InRelease\n",
            "Hit:4 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  Release\n",
            "Hit:5 http://archive.ubuntu.com/ubuntu bionic InRelease\n",
            "Get:6 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]\n",
            "Hit:7 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic InRelease\n",
            "Get:8 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]\n",
            "Hit:9 http://ppa.launchpad.net/cran/libgit2/ubuntu bionic InRelease\n",
            "Get:10 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]\n",
            "Hit:11 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease\n",
            "Get:13 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease [21.3 kB]\n",
            "Get:14 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1,503 kB]\n",
            "Get:15 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [22.8 kB]\n",
            "Get:16 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [2,765 kB]\n",
            "Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [29.8 kB]\n",
            "Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2,277 kB]\n",
            "Get:19 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [932 kB]\n",
            "Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [3,199 kB]\n",
            "Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [966 kB]\n",
            "Get:22 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main amd64 Packages [44.3 kB]\n",
            "Fetched 12.0 MB in 4s (2,946 kB/s)\n",
            "Reading package lists... Done\n",
            "tar: spark-3.0.2-bin-hadoop2.7.tgz: Cannot open: No such file or directory\n",
            "tar: Error is not recoverable: exiting now\n",
            "\u001b[K     |████████████████████████████████| 209.1 MB 57 kB/s \n",
            "\u001b[K     |████████████████████████████████| 144 kB 19.2 MB/s \n",
            "\u001b[K     |████████████████████████████████| 517 kB 64.0 MB/s \n",
            "\u001b[K     |████████████████████████████████| 198 kB 60.9 MB/s \n",
            "\u001b[?25h  Building wheel for pyspark (setup.py) ... \u001b[?25l\u001b[?25hdone\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "##2.Load the mdoel and make Sample Predictions "
      ],
      "metadata": {
        "id": "XiVdjjfzij2R"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "pipeline = nlu.load('en.ner.snips')\n",
        "pipeline.predict(\"Hey should we go grab a bite at a resturant?\")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 245
        },
        "id": "zzWPoMYZsVj2",
        "outputId": "c6630c91-4991-4eb5-c20b-a6f2b6f90545"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "classifierdl_use_snips download started this may take some time.\n",
            "Approximate size to download 21.3 MB\n",
            "[OK!]\n",
            "tfhub_use download started this may take some time.\n",
            "Approximate size to download 923.7 MB\n",
            "[OK!]\n",
            "sentence_detector_dl download started this may take some time.\n",
            "Approximate size to download 354.6 KB\n",
            "[OK!]\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                       sentence  \\\n",
              "0  Hey should we go grab a bite at a resturant?   \n",
              "\n",
              "                              sentence_embedding_use           snips  \\\n",
              "0  [-0.059718165546655655, 0.050846636295318604, ...  BookRestaurant   \n",
              "\n",
              "  snips_confidence_confidence  \n",
              "0                         1.0  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-d89db517-4e2d-47f2-a7d4-09e56365bb5b\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>sentence</th>\n",
              "      <th>sentence_embedding_use</th>\n",
              "      <th>snips</th>\n",
              "      <th>snips_confidence_confidence</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Hey should we go grab a bite at a resturant?</td>\n",
              "      <td>[-0.059718165546655655, 0.050846636295318604, ...</td>\n",
              "      <td>BookRestaurant</td>\n",
              "      <td>1.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d89db517-4e2d-47f2-a7d4-09e56365bb5b')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-d89db517-4e2d-47f2-a7d4-09e56365bb5b button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-d89db517-4e2d-47f2-a7d4-09e56365bb5b');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 2
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "##3.Define Sample Sentences"
      ],
      "metadata": {
        "id": "_XcMyXVXsdYW"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "sample_sentences = [\n",
        "\"i want to bring six of us to a bistro in town that serves hot chicken sandwich that is within the same area\", \n",
        "\"show weather forcast for the  stone memorial st  joseph peninsula state park on one hour from now\",\n",
        "\"Play the latest album  from Drake \"\n",
        "]"
      ],
      "metadata": {
        "id": "c_ty0gP6sglE"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "##4.Predict on Sample Sentences"
      ],
      "metadata": {
        "id": "qpD0_HqksiLw"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "pipeline.predict(sample_sentences)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 144
        },
        "id": "zynQvfNmWI50",
        "outputId": "1b2c656e-6405-4935-a653-eeb8cc2060e4"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                            sentence  \\\n",
              "0  i want to bring six of us to a bistro in town ...   \n",
              "1  show weather forcast for the stone memorial st...   \n",
              "2                   Play the latest album from Drake   \n",
              "\n",
              "                              sentence_embedding_use           snips  \\\n",
              "0  [0.032974954694509506, 0.026566199958324432, -...  BookRestaurant   \n",
              "1  [-0.02467229776084423, 0.05650756135582924, -0...      GetWeather   \n",
              "2  [-0.01043702568858862, -0.039566561579704285, ...       PlayMusic   \n",
              "\n",
              "  snips_confidence_confidence  \n",
              "0                         1.0  \n",
              "1                         1.0  \n",
              "2                    0.999877  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-fee06c73-7837-4e0c-8aee-294cecbe6af6\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>sentence</th>\n",
              "      <th>sentence_embedding_use</th>\n",
              "      <th>snips</th>\n",
              "      <th>snips_confidence_confidence</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>i want to bring six of us to a bistro in town ...</td>\n",
              "      <td>[0.032974954694509506, 0.026566199958324432, -...</td>\n",
              "      <td>BookRestaurant</td>\n",
              "      <td>1.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>show weather forcast for the stone memorial st...</td>\n",
              "      <td>[-0.02467229776084423, 0.05650756135582924, -0...</td>\n",
              "      <td>GetWeather</td>\n",
              "      <td>1.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>Play the latest album from Drake</td>\n",
              "      <td>[-0.01043702568858862, -0.039566561579704285, ...</td>\n",
              "      <td>PlayMusic</td>\n",
              "      <td>0.999877</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-fee06c73-7837-4e0c-8aee-294cecbe6af6')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-fee06c73-7837-4e0c-8aee-294cecbe6af6 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-fee06c73-7837-4e0c-8aee-294cecbe6af6');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 4
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "##5.Take a look at the parmaters of the pipeline"
      ],
      "metadata": {
        "id": "cEf6CWsxtDWJ"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "pipeline.print_info()"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "3TgLjxNltPCp",
        "outputId": "f604a689-17c9-465f-c587-5094bd76a54a"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The following parameters are configurable for this NLU pipeline (You can copy paste the examples) :\n",
            ">>> component_list['classifier_dl@tfhub_use'] has settable params:\n",
            "component_list['classifier_dl@tfhub_use'].setClasses(['PlayMusic', 'BookRestaurant', 'RateBook', 'SearchScreeningEvent', 'SearchCreativeWork', 'AddToPlaylist', 'GetWeather'])  | Info: get the tags used to trained this ClassifierDLModel | Currently set to : ['PlayMusic', 'BookRestaurant', 'RateBook', 'SearchScreeningEvent', 'SearchCreativeWork', 'AddToPlaylist', 'GetWeather']\n",
            "component_list['classifier_dl@tfhub_use'].setStorageRef('tfhub_use')  | Info: unique reference name for identification | Currently set to : tfhub_use\n",
            ">>> component_list['universal_sentence_encoder@tfhub_use'] has settable params:\n",
            "component_list['universal_sentence_encoder@tfhub_use'].setDimension(512)  | Info: Number of embedding dimensions | Currently set to : 512\n",
            "component_list['universal_sentence_encoder@tfhub_use'].setLoadSP(False)  | Info: Whether to load SentencePiece ops file which is required only by multi-lingual models. This is not changeable after it's set with a pretrained model nor it is compatible with Windows. | Currently set to : False\n",
            "component_list['universal_sentence_encoder@tfhub_use'].setStorageRef('tfhub_use')  | Info: unique reference name for identification | Currently set to : tfhub_use\n",
            ">>> component_list['document_assembler'] has settable params:\n",
            "component_list['document_assembler'].setCleanupMode('shrink')  | Info: possible values: disabled, inplace, inplace_full, shrink, shrink_full, each, each_full, delete_full | Currently set to : shrink\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "Looking Good! Let's test this model on a labelled dataset to see how it performs "
      ],
      "metadata": {
        "id": "1hF8dmLIkbSz"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "##6.Download Data\n",
        "\n",
        "we are going to test the model on [this](https://github.com/MiuLab/SlotGated-SLU) dataset \n",
        "\n",
        "\n"
      ],
      "metadata": {
        "id": "uRbusvKOkVac"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!wget http://ckl-it.de/wp-content/uploads/2022/05/Data.csv"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "KvD0rZTBrnrL",
        "outputId": "2654f555-890e-41f8-8bb2-209221b92fcd"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "--2022-05-19 22:12:57--  http://ckl-it.de/wp-content/uploads/2022/05/Data.csv\n",
            "Resolving ckl-it.de (ckl-it.de)... 217.160.0.108, 2001:8d8:100f:f000::209\n",
            "Connecting to ckl-it.de (ckl-it.de)|217.160.0.108|:80... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 975295 (952K) [text/csv]\n",
            "Saving to: ‘Data.csv’\n",
            "\n",
            "Data.csv            100%[===================>] 952.44K  1.01MB/s    in 0.9s    \n",
            "\n",
            "2022-05-19 22:12:59 (1.01 MB/s) - ‘Data.csv’ saved [975295/975295]\n",
            "\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import pandas  as pd \n",
        "df = pd.read_csv(\"Data.csv\")\n",
        "df.y = df.y.str.replace(\"\\n\",\"\")\n",
        "df"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 424
        },
        "id": "n-6bOT4krpr8",
        "outputId": "2e823257-09a2-4066-e6d9-86218df8b5b3"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                    Text               y\n",
              "0      me  maggie and ellen want to eat at lentil as ...  BookRestaurant\n",
              "1      add the singer maxine nightingale to the spani...   AddToPlaylist\n",
              "2          put jim fairchild onto spotlight spain 2016\\n   AddToPlaylist\n",
              "3                       play movement by duane allman \\n       PlayMusic\n",
              "4                      rate the descendants two points\\n        RateBook\n",
              "...                                                  ...             ...\n",
              "14479  book me a table for a party of eight in german...  BookRestaurant\n",
              "14480    add cary brothers to rock the 2000 s playlist\\n   AddToPlaylist\n",
              "14481  is it going to be rainy here one second from n...      GetWeather\n",
              "14482  i would give feast of the innocents a value of...        RateBook\n",
              "14483       will there be a cloud in vi in 14 minutes \\n      GetWeather\n",
              "\n",
              "[14484 rows x 2 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-6cbdbc3b-9ed2-440f-ab2a-cc69a0f1680c\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Text</th>\n",
              "      <th>y</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>me  maggie and ellen want to eat at lentil as ...</td>\n",
              "      <td>BookRestaurant</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>add the singer maxine nightingale to the spani...</td>\n",
              "      <td>AddToPlaylist</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>put jim fairchild onto spotlight spain 2016\\n</td>\n",
              "      <td>AddToPlaylist</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>play movement by duane allman \\n</td>\n",
              "      <td>PlayMusic</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>rate the descendants two points\\n</td>\n",
              "      <td>RateBook</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14479</th>\n",
              "      <td>book me a table for a party of eight in german...</td>\n",
              "      <td>BookRestaurant</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14480</th>\n",
              "      <td>add cary brothers to rock the 2000 s playlist\\n</td>\n",
              "      <td>AddToPlaylist</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14481</th>\n",
              "      <td>is it going to be rainy here one second from n...</td>\n",
              "      <td>GetWeather</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14482</th>\n",
              "      <td>i would give feast of the innocents a value of...</td>\n",
              "      <td>RateBook</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14483</th>\n",
              "      <td>will there be a cloud in vi in 14 minutes \\n</td>\n",
              "      <td>GetWeather</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>14484 rows × 2 columns</p>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-6cbdbc3b-9ed2-440f-ab2a-cc69a0f1680c')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-6cbdbc3b-9ed2-440f-ab2a-cc69a0f1680c button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-6cbdbc3b-9ed2-440f-ab2a-cc69a0f1680c');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 3
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "Let's take  a Peek at the distribution of the labels "
      ],
      "metadata": {
        "id": "mUl3_RmhuSHW"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "df.y.value_counts().plot.barh(title='Distribution of Labels')"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 298
        },
        "id": "7b9cKEyMtbWL",
        "outputId": "c6164d22-bf7d-4c27-bb9d-f27f2a25771b"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "<matplotlib.axes._subplots.AxesSubplot at 0x7f00a6712c10>"
            ]
          },
          "metadata": {},
          "execution_count": 5
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 432x288 with 1 Axes>"
            ],
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdQAAAEICAYAAADm2wU4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deZxdRZ3+8c9DgLAkBDGITYQENAJhCySgsiOIoig4IkFBiDggDoqojMIPZEDFdVREZQAVWUQJqMyAqASQTfbsIRAWIawRZAv7Fp7fH6caLpfec7o7ST/v1+u++tw6daq+p253f7vqnL5XtomIiIhFs0x/BxAREbE0SEKNiIioQRJqREREDZJQIyIiapCEGhERUYMk1IiIiBokoUYswSSdLOnrNbW1tqSnJQ0qz6+Q9O91tF3a+4uk/etqrxv9fkvSI5L+WWOboyRZ0rJ9eWws3pJQIxZTkuZJek7SU5KekHStpIMlvfpza/tg29/sYls7d1TH9r22h9heWEPsx0r6TVP7u9o+Y1Hb7mYcawNfAcbYfmsb+3eQdH9fxhRLryTUiMXbh20PBUYC3wW+Bvyq7k6W4tnS2sCjth/u70Bi6ZeEGrEEsL3A9gXABGB/SRsBSDpd0rfK9nBJfyqz2cckXS1pGUlnUSWWC8uS7lcblh0/I+le4G/tLEW+XdKNkp6U9H+SVit9vWFm1zoLlvQB4P8BE0p/M8v+V5eQS1xHS7pH0sOSzpQ0rO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tNqHUnTJV0padtSNqLE0hdxded16+vx2hZ4yPYdDWV9Pl5NvxuWhO8xIAk1+omkIcAfgMNsPwn8D/B2YCwwn2rZqa9tY3tzYFfgEEnbNe4sf4n3y/+ZSVoe+AhwXilaHMbrdfpzfNoj6SjgZeDsUjQfWNv2ZsCXgd9KWqUPQ1rsXrcmn+D1f7T1+Xi18bvhVYvj91ijJNSB5wFgrYbnbytlfUbSclQ/MGfb/iOA7YdsL7T9CvALXlum7LN4bT9Qvj4MnF9ieKh1Kbd8fbiv4yp2BabZfqjE2O/jVXR3fPosPkkTgd2AfcovYsqS6qNleyrV9cl3lhgal4V7Ja4evG59OV7LAv8GTGqIt0/Hq63fDSzG32PNklAHnpuA0ZLWKbOevYEL+qrzco3mV8Cttn/UUN54/fGjQOsdiBcAe0saLGkdYDTVzRB1x7WypKGt21Q3tdxc+m+9S3B/4P8a4tqv3Gn4bmBBw7JUb3jdzKG/x6tBd8fnYmAXSW8qy527lLJaSfoA8FXgI7afbShfXdKgsr0u1fjcVWJ7UtK7y/fofg3nUmdc3X3d+vLndWdgru1Xl3L7crza+93AYvo91qa+uPMpj8XrQXV33O1Uf20e1cd9b0O1ZDMLmFEeHwTOAmaX8guAloZjjiqx3sYi3knYQVzrUt1BOROY0zouwJuBy4A7gEuB1Uq5gJ+XuGYD43txzFYGHgWGNZT1+XhRJfT5wEtU16U+05PxobqmeWd5fLqX4rqT6jpa6/fYyaXux8rrOwOYBny4oZ3xVAnuH8DPKO8kV3Nc3X7d6v55bSuuUn46cHBT3b4cr/Z+N/T791hXH3nrwYiIiBpkyTciIqIGSagRERE1SEKNiIioQRJqREREDZJQIyIiapCEGhERUYMk1IiIiBr8f64vK5ahbBttAAAAAElFTkSuQmCC\n"
          },
          "metadata": {
            "needs_background": "light"
          }
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "##7.Make Predictions with the model"
      ],
      "metadata": {
        "id": "KHxOy5o9uyTG"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "predctions = pipeline.predict(df,output_level = 'document')"
      ],
      "metadata": {
        "id": "QpmPv2q5uVyd"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "predctions"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 641
        },
        "id": "j4JpnxjzMOsV",
        "outputId": "48d8f9f8-93fa-4db0-8439-e3b6420f6fc6"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                document  \\\n",
              "0      me maggie and ellen want to eat at lentil as a...   \n",
              "1      add the singer maxine nightingale to the spani...   \n",
              "2            put jim fairchild onto spotlight spain 2016   \n",
              "3                          play movement by duane allman   \n",
              "4                        rate the descendants two points   \n",
              "...                                                  ...   \n",
              "14479    book me a table for a party of eight in germany   \n",
              "14480      add cary brothers to rock the 2000 s playlist   \n",
              "14481   is it going to be rainy here one second from now   \n",
              "14482   i would give feast of the innocents a value of 1   \n",
              "14483          will there be a cloud in vi in 14 minutes   \n",
              "\n",
              "                                  sentence_embedding_use           snips  \\\n",
              "0      [[-0.017013607546687126, 0.034057579934597015,...  BookRestaurant   \n",
              "1      [[-0.058401599526405334, 0.030685268342494965,...   AddToPlaylist   \n",
              "2      [[0.07778624445199966, -0.04414999112486839, -...   AddToPlaylist   \n",
              "3      [[-0.019449099898338318, -0.016717910766601562...       PlayMusic   \n",
              "4      [[-0.07902456074953079, -0.0464814268052578, 0...        RateBook   \n",
              "...                                                  ...             ...   \n",
              "14479  [[-0.0052231671288609505, 0.010193767957389355...  BookRestaurant   \n",
              "14480  [[-0.025543220341205597, 0.022171588614583015,...   AddToPlaylist   \n",
              "14481  [[-0.06673435866832733, 0.030579980462789536, ...      GetWeather   \n",
              "14482  [[-0.021519748494029045, -0.04700062796473503,...        RateBook   \n",
              "14483  [[-0.03852422162890434, 0.03333006799221039, -...      GetWeather   \n",
              "\n",
              "      snips_confidence_confidence  \\\n",
              "0                             1.0   \n",
              "1                             1.0   \n",
              "2                        0.999995   \n",
              "3                             1.0   \n",
              "4                             1.0   \n",
              "...                           ...   \n",
              "14479                         1.0   \n",
              "14480                         1.0   \n",
              "14481                         1.0   \n",
              "14482                         1.0   \n",
              "14483                         1.0   \n",
              "\n",
              "                                                    text               y  \n",
              "0      me  maggie and ellen want to eat at lentil as ...  BookRestaurant  \n",
              "1      add the singer maxine nightingale to the spani...   AddToPlaylist  \n",
              "2          put jim fairchild onto spotlight spain 2016\\n   AddToPlaylist  \n",
              "3                       play movement by duane allman \\n       PlayMusic  \n",
              "4                      rate the descendants two points\\n        RateBook  \n",
              "...                                                  ...             ...  \n",
              "14479  book me a table for a party of eight in german...  BookRestaurant  \n",
              "14480    add cary brothers to rock the 2000 s playlist\\n   AddToPlaylist  \n",
              "14481  is it going to be rainy here one second from n...      GetWeather  \n",
              "14482  i would give feast of the innocents a value of...        RateBook  \n",
              "14483       will there be a cloud in vi in 14 minutes \\n      GetWeather  \n",
              "\n",
              "[14484 rows x 6 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-7fa188d2-7482-49c8-b7b0-892c8f419cad\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>document</th>\n",
              "      <th>sentence_embedding_use</th>\n",
              "      <th>snips</th>\n",
              "      <th>snips_confidence_confidence</th>\n",
              "      <th>text</th>\n",
              "      <th>y</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>me maggie and ellen want to eat at lentil as a...</td>\n",
              "      <td>[[-0.017013607546687126, 0.034057579934597015,...</td>\n",
              "      <td>BookRestaurant</td>\n",
              "      <td>1.0</td>\n",
              "      <td>me  maggie and ellen want to eat at lentil as ...</td>\n",
              "      <td>BookRestaurant</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>add the singer maxine nightingale to the spani...</td>\n",
              "      <td>[[-0.058401599526405334, 0.030685268342494965,...</td>\n",
              "      <td>AddToPlaylist</td>\n",
              "      <td>1.0</td>\n",
              "      <td>add the singer maxine nightingale to the spani...</td>\n",
              "      <td>AddToPlaylist</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>put jim fairchild onto spotlight spain 2016</td>\n",
              "      <td>[[0.07778624445199966, -0.04414999112486839, -...</td>\n",
              "      <td>AddToPlaylist</td>\n",
              "      <td>0.999995</td>\n",
              "      <td>put jim fairchild onto spotlight spain 2016\\n</td>\n",
              "      <td>AddToPlaylist</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>play movement by duane allman</td>\n",
              "      <td>[[-0.019449099898338318, -0.016717910766601562...</td>\n",
              "      <td>PlayMusic</td>\n",
              "      <td>1.0</td>\n",
              "      <td>play movement by duane allman \\n</td>\n",
              "      <td>PlayMusic</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>rate the descendants two points</td>\n",
              "      <td>[[-0.07902456074953079, -0.0464814268052578, 0...</td>\n",
              "      <td>RateBook</td>\n",
              "      <td>1.0</td>\n",
              "      <td>rate the descendants two points\\n</td>\n",
              "      <td>RateBook</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14479</th>\n",
              "      <td>book me a table for a party of eight in germany</td>\n",
              "      <td>[[-0.0052231671288609505, 0.010193767957389355...</td>\n",
              "      <td>BookRestaurant</td>\n",
              "      <td>1.0</td>\n",
              "      <td>book me a table for a party of eight in german...</td>\n",
              "      <td>BookRestaurant</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14480</th>\n",
              "      <td>add cary brothers to rock the 2000 s playlist</td>\n",
              "      <td>[[-0.025543220341205597, 0.022171588614583015,...</td>\n",
              "      <td>AddToPlaylist</td>\n",
              "      <td>1.0</td>\n",
              "      <td>add cary brothers to rock the 2000 s playlist\\n</td>\n",
              "      <td>AddToPlaylist</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14481</th>\n",
              "      <td>is it going to be rainy here one second from now</td>\n",
              "      <td>[[-0.06673435866832733, 0.030579980462789536, ...</td>\n",
              "      <td>GetWeather</td>\n",
              "      <td>1.0</td>\n",
              "      <td>is it going to be rainy here one second from n...</td>\n",
              "      <td>GetWeather</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14482</th>\n",
              "      <td>i would give feast of the innocents a value of 1</td>\n",
              "      <td>[[-0.021519748494029045, -0.04700062796473503,...</td>\n",
              "      <td>RateBook</td>\n",
              "      <td>1.0</td>\n",
              "      <td>i would give feast of the innocents a value of...</td>\n",
              "      <td>RateBook</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14483</th>\n",
              "      <td>will there be a cloud in vi in 14 minutes</td>\n",
              "      <td>[[-0.03852422162890434, 0.03333006799221039, -...</td>\n",
              "      <td>GetWeather</td>\n",
              "      <td>1.0</td>\n",
              "      <td>will there be a cloud in vi in 14 minutes \\n</td>\n",
              "      <td>GetWeather</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>14484 rows × 6 columns</p>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7fa188d2-7482-49c8-b7b0-892c8f419cad')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-7fa188d2-7482-49c8-b7b0-892c8f419cad button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-7fa188d2-7482-49c8-b7b0-892c8f419cad');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 24
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## 8.Evaluate Predictions "
      ],
      "metadata": {
        "id": "y03ZPigmGPYL"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.metrics import classification_report\n",
        "print(classification_report(predctions['y'], predctions['snips']) )"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "yfJtQLGDu8nN",
        "outputId": "9d6080f9-d5b1-423c-98b5-3c61bcad8346"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "                      precision    recall  f1-score   support\n",
            "\n",
            "       AddToPlaylist       0.99      0.99      0.99      2042\n",
            "      BookRestaurant       0.99      1.00      1.00      2073\n",
            "          GetWeather       1.00      0.99      1.00      2100\n",
            "           PlayMusic       0.96      0.97      0.97      2100\n",
            "            RateBook       1.00      1.00      1.00      2056\n",
            "  SearchCreativeWork       0.94      0.95      0.94      2054\n",
            "SearchScreeningEvent       0.98      0.96      0.97      2059\n",
            "\n",
            "            accuracy                           0.98     14484\n",
            "           macro avg       0.98      0.98      0.98     14484\n",
            "        weighted avg       0.98      0.98      0.98     14484\n",
            "\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "VXu21c0iQRSC"
      },
      "source": [
        "# There are many more models you can put to use in 1 line of code!\n",
        "## Checkout [the Modelshub](https://nlp.johnsnowlabs.com/models) and the [NLU Namespace](https://nlu.johnsnowlabs.com/docs/en/spellbook) for more models\n",
        "\n",
        "### NLU Webinars and Video Tutorials\n",
        "- [NLU & Streamlit Tutorial](https://vimeo.com/579508034#)\n",
        "- [Crash course of the 50 + Medical Domains and the 200+ Healtchare models in NLU](https://www.youtube.com/watch?v=gGDsZXt1SF8)\n",
        "- [Multi Lingual NLU Webinar - Tutorial on Chinese News dataset](https://www.youtube.com/watch?v=ftAOqJuxnV4)\n",
        "- [John Snow Labs NLU: Become a Data Science Superhero with One Line of Python code](https://events.johnsnowlabs.com/john-snow-labs-nlu-become-a-data-science-superhero-with-one-line-of-python-code?hsCtaTracking=c659363c-2188-4c86-945f-5cfb7b42fcfc%7C8b2b188b-92a3-48ba-ad7e-073b384425b0)\n",
        "- [Python Web Def Conf - Python's NLU library: 1,000+ Models, 200+ Languages, State of the Art Accuracy, 1 Line of Code](https://2021.pythonwebconf.com/presentations/john-snow-labs-nlu-the-simplicity-of-python-the-power-of-spark-nlp)\n",
        "- [NYC/DC NLP Meetup with NLU](https://youtu.be/hJR9m3NYnwk?t=2155)\n",
        "\n",
        "### More ressources \n",
        "- [Join our Slack](https://join.slack.com/t/spark-nlp/shared_invite/zt-lutct9gm-kuUazcyFKhuGY3_0AMkxqA)\n",
        "- [NLU Website](https://nlu.johnsnowlabs.com/)\n",
        "- [NLU Github](https://github.com/JohnSnowLabs/nlu)\n",
        "- [Many more NLU example tutorials](https://github.com/JohnSnowLabs/nlu/tree/master/examples)\n",
        "- [Overview of every powerful nlu 1-liner](https://nlu.johnsnowlabs.com/docs/en/examples)\n",
        "- [Checkout the Modelshub for an overview of all models](https://nlp.johnsnowlabs.com/models) \n",
        "- [Checkout the NLU Namespace where you can find every model as a tabel](https://nlu.johnsnowlabs.com/docs/en/spellbook)\n",
        "- [Intro to NLU article](https://medium.com/spark-nlp/1-line-of-code-350-nlp-models-with-john-snow-labs-nlu-in-python-2f1c55bba619)\n",
        "- [Indepth and easy Sentence Similarity Tutorial, with StackOverflow Questions using BERTology embeddings](https://medium.com/spark-nlp/easy-sentence-similarity-with-bert-sentence-embeddings-using-john-snow-labs-nlu-ea078deb6ebf)\n",
        "- [1 line of Python code for BERT, ALBERT, ELMO, ELECTRA, XLNET, GLOVE, Part of Speech with NLU and t-SNE](https://medium.com/spark-nlp/1-line-of-code-for-bert-albert-elmo-electra-xlnet-glove-part-of-speech-with-nlu-and-t-sne-9ebcd5379cd)"
      ]
    }
  ]
}